<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>时间模板</title>
	</head>
	
    <body>
	   <div class="col-md-12">
	      <!-- BEGIN EXAMPLE TABLE PORTLET-->
	      <div class="portlet">
	      	 <div class="table-toolbar">
             </div> 
	         <div class="portlet-title">
	            <div class="caption"><i class="icon-edit"></i>模板列表</div>
	         </div>
	         <div class="portlet-body">
	          <div class="clear"></div>
	            <s:if test="%{templates.size >0}">
	            <table class="table table-striped table-hover table-bordered" id="floorTable">
	               <thead>
	                  <tr>
	                     <th width="180px">模板名称</th>
	                     <th width="180px">启用</th>
	                     <th width="180px">类型</th>
                         <th width="80px">编辑</th>
	                  </tr>
	               </thead>
	               <tbody>
	               <s:iterator value="templates" >
	                  <tr >
	                  	
                         <td><s:property value="name" /></td>
                         <td>
                         	<s:if test="enabled">
                         		是 
                         	</s:if>
                         	<s:else>
                         		否
                         	</s:else>
                         </td>
                         <td>
                         	<s:if test="type">
                         		取件
                         	</s:if>
                         	<s:else>
                         		送件
                         	</s:else>
                         </td>
                         <td>
	                         <a class="edit" href="<s:url action="edit" namespace="/admin/time" />?id=<s:property value="entityId" />" >编辑</a>
	                         <a class="delete" href="javascript:;" targetId="<s:property value="entityId" />">删除</a>
                         </td>
	                  </tr>
	                  </s:iterator>
	               </tbody>
	            </table>
	            
	            </s:if><s:else>
	            <s:include value="/WEB-INF/jsp/admin/empty-record.jsp" >
	            	<s:param name="moduleTitle">时间模板</s:param>
	            </s:include>
	            </s:else>
	         </div>
	      </div>
	      <!-- END EXAMPLE TABLE PORTLET-->
	   </div>
	<script type="text/javascript">
	     
		$(document).ready(function() {
		    
			$('#floorTable a.delete').live('click',function(e) {
			
			    if (!confirm("您确定要删除该记录？")) {
			        return;
			    }
			
			    var targetId = $(this).attr('targetId');
			    var url = '<s:url action="delete" namespace="/admin/time" />?id=' + targetId;
			    window.location = url;
			});
        
           TitleActionBar.inertPlusButton("新增时间模板",'<s:url action="add" namespace="/admin/time" />');
        
	   	});
	</script>
</body>
</html>